<?php
/**
 * List of available mission job boards.
 * 
 * @author Xavier VILAIN
 * @package Hive\Mission
 * 
 */

use Fox\Html\Button;
use Fox\Behaviors;
use Hive\Mission;
use Fox\Generator;
$xview = Xview::instance();
$reload = $xview->val('reload');
// Customizing
$customizing = Hive\Admin\Customizing::instance();
$customizing->trackSummaryPage(array('mod' => 'missions','act'=>'boards','sac'=> null));
if(!Fox\Authorization\Manager::check(Hive\Admin\Customizing::AUTH_MISSION_BOARDS)) {
	echo $xview->accessDenied(Msg(Hive::BUNDLE,Hive::ERR_ADMIN_ACCES_DENIED),null,true);
	exit;
}

$screen = new Fox\Html\Screen('sCustomizing');
$screen->pageTitle(Msg(Hive::BUNDLE,Hive::MISSION_JOB_BOARDS_CUSTOMIZING));
$screen->message(Msg(Hive::BUNDLE,Hive::MISSION_JOB_BOARDS_CUSTOMIZING_HELP));

// Load All types and display the data grid
$types = Fox\Dao::finder(Mission\Job\Board::className())
	->find();
$grid = new Fox\Grid('gTypes',Generator::url('missions','boards',null,array('reload' => true)));
$grid->fieldcat(array('label','url','idele'));
$grid->fieldcat()->switchToObjectMode();
$grid->fieldcat()->setGenerators(array(
	'idele' => Generator::useValue('?')
));
$grid->footer()->add(new Button('adnew'))
		->behaviors(Behaviors::action(
			Generator::url('missions','boards','modify'),
			true)
		);
// Deletion Behavior
$grid->fieldcat()
	->field('idele')
	->renderer()
		->behaviors(Behaviors::action(
			Generator::url('missions','boards','delete',array('inlineid' => Generator::call('getInLineId'))),
			true)
		);
$grid->fieldcat()->behaviors(Behaviors::action(
	Generator::url('missions','boards','modify',array('inlineid' => Generator::call('getInLineId'))),
	true
));
$grid->initialize($types);
$screen->add($grid);
echo $screen->display();